package net.lcheng.service.impl;

import net.lcheng.dao.WxShopWeixinConfigMapper;
import net.lcheng.model.WxShopWeixinConfig;
import net.lcheng.model.WxShopWeixinConfigExample;
import net.lcheng.service.WxShopWeixinConfigService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by zwr on 2016/7/5 0005.
 */
@Service
public class WxShopWeixinConfigServiceImpl implements WxShopWeixinConfigService {
 @Resource
 private WxShopWeixinConfigMapper mapper;

    @Override
    public int addConfig(WxShopWeixinConfig wxShopWeixinConfig) {
        return mapper.insert(wxShopWeixinConfig);
    }

    @Override
    public WxShopWeixinConfig getWxShopWeixinConfigByUserId(String userId) {
        WxShopWeixinConfigExample example=new WxShopWeixinConfigExample();
        example.or().andUserIdEqualTo(userId);
        List<WxShopWeixinConfig>list=mapper.selectByExample(example);
        if (list!=null && list.size()>0){
            return list.get(0);
        }else
        return null;
    }
}
